import 'package:lovify/core/network/model/response_entity.dart';
import 'package:lovify/models/user.dart';

import 'base_service.dart';

class UserService extends BaseService<User> {
  UserService()
      : super(
          endpoint: '/user',
          toJson: (user) => user.toJson(),
          fromJson: (json) => User.fromJson(json as Map<String, dynamic>),
        );

  Future<ResponseEntity<User>> getUserByDeviceId(String id) async {
    final response = await apiClient.get('$endpoint/findByDeviceId/$id');
    return ResponseEntity.fromJson(response, fromJson);
  }
}
